package com.rongke.web.yiyuan;

import com.alibaba.fastjson.JSONObject;

/**
 * Created by Administrator on 2018/3/14 0014.
 */
public class YiyuanApi {
    private static final String appid = "59113";// appid
    private static final String secret  = "bca896ab611f42628caf01da6efb940e";//密钥

    /**
     * 根据cod查询股票
     */
    public  static JSONObject selectShareByCode(String code) {
        String res = (new ShowApiRequest("http://route.showapi.com/131-46", appid, secret)).addTextPara("stocks", code).addTextPara("needIndex", "0").post();
        return JSONObject.parseObject(res);
    }

    /**
     * 大盘股
     */
    public static void selectBigShare() {
        String res = (new ShowApiRequest("http://route.showapi.com/131-45", appid, secret)).addTextPara("stocks", "").post();
        System.out.println(res);
    }

    /**
     * 股票列表
     */
    public static JSONObject selectAllShare(String page,String maket){
        String res = (new ShowApiRequest("http://route.showapi.com/131-53", appid, secret)).addTextPara("market", maket).addTextPara("name", "").addTextPara("code", "").addTextPara("page",page).post();
        return JSONObject.parseObject(res);
    }

    public static void main(String[] args) {
        String res = (new ShowApiRequest("http://route.showapi.com/131-53", appid, secret)).addTextPara("market", "").addTextPara("name", "").addTextPara("code", "").addTextPara("page","5").post();
        System.out.println(res);
    }
}
